package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.GongSiXinXiBiaoDaoImpl;
import com.ysd.dao.impl.tjXinWen2DaoImpl;
import com.ysd.dao.impl.tjXinWenDaoImpl;
import com.ysd.dao.impl.tuiJianCPDaoImpl;
import com.ysd.entity.GongSiXinXiBiao;
import com.ysd.entity.tjXinWen;
import com.ysd.entity.tuiJianCP;


public class HomeServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调用实现类方法
		GongSiXinXiBiaoDaoImpl XinXiDao = new GongSiXinXiBiaoDaoImpl();
		GongSiXinXiBiao xinxi=XinXiDao.getGongSiXinXiBiao();
		request.setAttribute("xinxi", xinxi);
		
		//随机图
		tuiJianCPDaoImpl tjcpDao = new tuiJianCPDaoImpl();
		List<tuiJianCP> tuichanpinList =  tjcpDao.gettuiJianCPList();
		request.setAttribute("tuichanpinList", tuichanpinList);
		
		//随机资讯
		tjXinWenDaoImpl tjxwDao = new tjXinWenDaoImpl();
		List<tjXinWen> tjxwList = tjxwDao.gettjXinWenList();
		request.setAttribute("tjxwList",tjxwList );
		
		//随机咨询 2
		tjXinWen2DaoImpl tjxw2Dao = new tjXinWen2DaoImpl();
		List<tjXinWen> tjxw2List = tjxw2Dao.gettjXinWenList();
		request.setAttribute("tjxw2List",tjxw2List );
		
		
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
